package net.matuschek.examples;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import net.matuschek.jobo.JoBoSwing;


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author user
 */
public class testMultipleLinks {

    private  Vector urlStringVector;
    private  Vector URLs_Vector;
    private Vector JoboSwingVector;
    private static testMultipleLinks testMultipleLinks;
    private static JoBoSwing joboSwing;
    private URL tempURL;
    private static String path = "D:/Temp/New Folder";

    public  URL u1;
    public  URL u2;
    public  URL u3;
    public  URL u4;
    public  URL u5;
    public  URL u6;
    public  URL u7;
    public  URL u8;
    public  URL u9;

    private  String URL1 = "http://www.ebay.com/";
    private  String URL2 = "http://www.mrt.ac.lk";
    private  String URL3 = "http://www.tendollarclick.com";
    private  String URL4 = "http://www.wijayaholidayresort.com";
    private  String URL5 = "http://www.mobitel.lk";
    private  String URL6 = "http://www.gliffy.com";
    private  String URL7 = "http://www.google.lk";
    private  String URL8 = "http://www.ibm.com";
    private  String URL9 = "http://www.openoffice.org";

    public testMultipleLinks() {
    }



    testMultipleLinks(Vector v){
        urlStringVector = v;
        joboSwing = new JoBoSwing(urlStringVector, path, 0);
        joboSwing.setVisible(true);
        joboSwing.miniTest();
    }

    public void runTest(Vector URLsToDownload){
        URLs_Vector = URLsToDownload;
        String tempURLString;
        JoboSwingVector = new Vector();

        for (int i=0; i<URLs_Vector.size(); i++){
            tempURLString = (String) URLs_Vector.get(i);
            try {
                tempURL = new URL(tempURLString);
            } catch (MalformedURLException ex) {
                System.out.println("Error occured while while creating the URL form the String");
            }
            URLs_Vector.add(tempURL);
            joboSwing = new JoBoSwing();
            JoboSwingVector.add(joboSwing);
            //joboSwing.miniTest(tempURL);
        }
    }
    
    public static void main(String[] args) {
        testMultipleLinks = new testMultipleLinks();
        testMultipleLinks.startTest();
        System.out.println("passing from Test_multipleLinks is " + testMultipleLinks.getUrlStringVector());
        joboSwing = new JoBoSwing(testMultipleLinks.getUrlStringVector(), path, 0);
        joboSwing.miniTest();
    }

    public void testLinkSelectSwing(){

    }


    public Vector getUrlStringVector() {
        return urlStringVector;
    }



    private void startTest(){

        urlStringVector = new Vector();
        urlStringVector.add(URL1);
        urlStringVector.add(URL2);
        urlStringVector.add(URL3);
        urlStringVector.add(URL4);
        urlStringVector.add(URL5);
        urlStringVector.add(URL6);
        urlStringVector.add(URL7);
        urlStringVector.add(URL9);

//        try {
//            u1 = new URL(URL1);
//            u2 = new URL(URL2);
//            u3 = new URL(URL3);
//            u4 = new URL(URL4);
//            u5 = new URL(URL5);
//            u6 = new URL(URL6);
//            u7 = new URL(URL7);
//            u8 = new URL(URL8);
//            u9 = new URL(URL9);
//        } catch (MalformedURLException ex) {
//            ex.printStackTrace();
//        }


//
//        JoBoSwing JBSwng = new JoBoSwing();
//        JBSwng.miniTest(u1);
//        JBSwng.miniTest(u2);
//        JBSwng.miniTest(u3);
//        JBSwng.miniTest(u4);
//        JBSwng.miniTest(u5);
//        JBSwng.miniTest(u6);
//        JBSwng.miniTest(u7);
//        JBSwng.miniTest(u9);
    }


}
